const Koa = require('koa');
const Router = require('koa-router');
const serve = require('koa-static');

const app = new Koa();
const router = new Router();

// 提供静态文件服务
app.use(serve(__dirname + '/public'));

// 定义路由
router.get('/', async (ctx) => {
  ctx.body = 'Welcome to the home page!';
});

// 使用路由中间件
app.use(router.routes()).use(router.allowedMethods());

app.listen(3000, () => {
  console.log('Server is running at http://localhost:3000');
});